<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.active{
				color: red;
			}
		</style>
	</head>
	<body>
		<div id="app">
				<li v-for="(item,index) in movies" 
				:class="{active: currentIndex === index}" @click="liClick(index)">{{item}}</li>
			</ul>
		</div>
		<script src="../js/vue.js"></script>
		<script>
			const app=new Vue({
				el:'#app',
				data:{
					movies:['海王','海贼王','加勒比海盗','海尔兄弟'],
					currentIndex:0
				},
				methods:{
					liClick(index){
						this.currentIndex=index;
					}
				}
			})
		</script>
	</body>
</html>
